package com.shwread.httpsdk.test;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.shwread.android.qysw.activity.BaseBusinessActivity;
import com.shwread.android.qysw10000136.R;
import com.shwread.httpsdk.http.callback.ActionListener;
import com.shwread.httpsdk.http.face.QryUnReadTotalAction;

import logic.constants.Const;
import logic.util.Util;


public class NetFaceTestActivity
        
        extends
        BaseBusinessActivity
        implements
        ActionListener
{
	
	private Button  btnTest;
	private Context context;
	
	private Handler handler = new Handler()
	                        {
		                        
		                        @Override
		                        public void handleMessage(Message msg) {
			                        super.handleMessage(msg);
			                        
		                        }
		                        
	                        };
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_activity);
//		Const.phone_number = "18968107866";
//		Const.login_key = "Tobx6BmN";
		Const.phone_number = "15088707673";
		Const.login_key = "B$%MKgwt";
		
		
		
		
		context = this;
		
		btnTest = (Button) findViewById(R.id.test);
		btnTest.setOnClickListener(new OnClickListener()
		{
			
			@Override
			public void onClick(View v) {
				test();
			}
		});
		
	}
	
	void test() {
//		UserLoginAction action = new UserLoginAction(context, Const.phone_number, MD5.MD5Encode("123456"), System.currentTimeMillis(), NetFaceTestActivity.this);
		/***********用户***********/
//		QryAccountInfoAction action =new QryAccountInfoAction(context, this);
//		ModPasswordAction action =new ModPasswordAction(context, "234567", "123456", this);
//		ModAccountInfoAction action = new ModAccountInfoAction(context, "灵活死胖子", "男", "19840317", "18968107866", "fangwei@hzdracom.com", "文一路", this);
//		FeedBackAction action = new FeedBackAction(context, "加油...", this);
//		QryNewVersionAction action = new QryNewVersionAction(context, 1000, this);
//		QryUseServiceFinishedAction action = new QryUseServiceFinishedAction(context, this);
//		ResetPasswordFirstStepAction action = new ResetPasswordFirstStepAction(context, "18968107866", this);
//		ResetPasswordSecondStepAction action = new ResetPasswordSecondStepAction(context, "18968107866", "384412", this);
//		ResetPasswordThirdStepAction action = new ResetPasswordThirdStepAction(context, "18968107866", "384412", "234567", this);
		
		/*************精品****************/
//		QrySpecialInfoListAction action = new QrySpecialInfoListAction(context, this);
//		QryBooksListAction action = new QryBooksListAction(context, NetFaceTestActivity.this);
//		QryBooksByColumnIdAction action = new QryBooksByColumnIdAction(context, 1, 1, 10, this);
//		QryBooksByNameOrAuthurAction action= new QryBooksByNameOrAuthurAction(context, "1", 1, 10, this);
		
		/***************企业专区****************/
//		QryEnterpriseZoneBannerAction action = new QryEnterpriseZoneBannerAction(context, NetFaceTestActivity.this);
//		QryEnterpriseZoneBookIndexAction action = new QryEnterpriseZoneBookIndexAction(context, NetFaceTestActivity.this);
//		QryEnterpriseZoneBookByTypeAction action = new QryEnterpriseZoneBookByTypeAction(context, "2", this);
//		QryEnterpriseZoneBookMoreAction action = new QryEnterpriseZoneBookMoreAction(context, "1", "0", "0", 1, 10, NetFaceTestActivity.this);
//		QryEnterpriseJournalListAction action = new  QryEnterpriseJournalListAction(context, 1, 5, this);				
//		QryEnterpriseNewsListAction action = new QryEnterpriseNewsListAction(context, 1, 5, this);

		/****************消息中心*******************/
//		QryMsgsByPositionAction action = new QryMsgsByPositionAction(context, "4", "", 1, 10, this);
//		QryMsgByIdAction action = new QryMsgByIdAction(context, "100", this);
//		ReadMsgBySendIdAction action = new ReadMsgBySendIdAction(context, "100", this);
//		DelMsgBySendIdAction action = new DelMsgBySendIdAction(context, "100", this);
//		RegisterMsgAction action = new RegisterMsgAction(context, "y", "0", "", this);
		QryUnReadTotalAction action = new QryUnReadTotalAction(context, "1", this);
		
		/*************内容***************/
//		QryChapterListAction action = new QryChapterListAction(context, "1000002664641", "2", 1, 0, this);
//		QryChapterInfoAction action = new QryChapterInfoAction(context, "1000002664641", "2", this);
		
		
		action.start();
	}
	
	@Override
	public Handler getUIHandler() {
		return handler;
	}
	
	@Override
	public void OK(Object obj) {
		
		handler.post(new Runnable()
		{
			
			@Override
			public void run() {
				Util.showToast(context, "成功");
			}
		});
		
	}
	
	@Override
	public void ERROR(final int resultCode, final String message) {
		
		handler.post(new Runnable()
		{
			
			@Override
			public void run() {
				Util.showToast(context, "失败 code：" + resultCode + "||" + message);
			}
		});
		
	}
	
	@Override
	public void HTTPERROR(int statusCode) {
		// TODO Auto-generated method stub
		
	}
	
}
